
class MinStack(object):

    def __init__(self):
        """
        initialize your data structure here.
        """
        self.data = []
        self.min_data = []
        

    def push(self, x):
        """
        :type x: int
        :rtype: None
        """
        self.data.append(x)
        min_num = min(x, self.min_data[-1]) if self.min_data else x
        self.min_data.append(min_num)
        

    def pop(self):
        """
        :rtype: None
        """
        self.data.pop()
        self.min_data.pop()

    def top(self):
        """
        :rtype: int
        """
        return self.data[-1]

    def getMin(self):
        """
        :rtype: int
        """
        return self.min_data[-1]

if __name__ == '__main__':
    minStack = MinStack()
    minStack.push(-2)
    minStack.push(0)
    minStack.push(-3)
    print minStack.getMin()
    minStack.pop()
    print minStack.top()
    print minStack.getMin()